from enum import Enum
import math
from typing import Literal
import uuid
from abc import ABC

class RecFoundation:
    """Rectangular shallow foundation."""
    def __init__(self, name: Any = None, width: float = 8.0, length: float = 20.0, design_ground_elev: float = 0.0, bottom_elev: float = ..., ave_unit_weight: float = 20, design_load: float = 2100):
        """
        Initialize RecFoundation Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the foundation.
        
        width (m): float, default: 8.0
            The width of the foundation.
        
        length (m): float, default: 20.0
            The length of the foundation.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        bottom_elev (m): float, default: -2.0
            The bottom elevation of the foundation.
        
        ave_unit_weight (kN/m³): float, default: 20
            The average unit weight of foundation and its fill.
        
        design_load (kN): float, default: 2100
            The design load of the foundation.
        """
        ...
    @property
    def bottom_depth(self) -> float:
        """Return the bottom depth (m) of the foundation from the design_ground."""
        ...
    @property
    def bottom_stress(self) -> float:
        """Return the bottom stress (kPa) of the foundation."""
        ...
    @bottom_stress.setter
    def bottom_stress(self, value: float) -> Any:
        ...

class PileType(str, Enum):
    """Pile type"""
    def __new__(cls, value, title):
        ...
    BoredPile: Any
    PostGroutedPile: Any
    ConcreteSquarePile: Any
    SteelPipePile: Any
    ConcreteHollowPile: Any
    RockSocketedPile: Any
    FlexiblePile: Any
    RigidPile: Any

class BasicPile(ABC):
    """Basic pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0):
        """
        Initialize BasicPile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.   
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        """
        ...
    @property
    def pile_type(self) -> Any:
        """Return the type of the pile."""
        ...

class BoredPile(BasicPile):
    """Bored pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, diameter: float = 0.8):
        """
        Initialize BoredPile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        diameter (m): float, default: 0.8
            The diameter of the pile.
        """
        ...
    @property
    def area(self) -> float:
        """Return the area of the pile."""
        ...
    @property
    def perimeter(self) -> float:
        """Return the perimeter of the pile."""
        ...

class PostGroutedPile(BasicPile):
    """Post grouted pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, diameter: float = 0.8, formation: Literal[Any, Any] = "mud_wall", grout_position: Literal[Any, Any] = "pile_base"):
        """
        Initialize PostGroutedPile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        diameter (m): float, default: 0.8
            The diameter of the pile.
        
        formation: Literal["mud_wall", "dry_work"], default: "mud_wall"
            The formation of the pile.
            mud_wall: 泥浆护壁成孔
            dry_work: 干作业成孔
        
        grout_position: Literal["pile_base", "base_and_skin"], default: "pile_base"
            The position of the grout.
            pile_base: 单一桩端注浆
            base_and_skin: 桩端桩侧复式注浆
        """
        ...
    @property
    def grouted_length(self) -> float:
        """Return the length of the grouted part of the pile."""
        ...
    @property
    def area(self) -> float:
        """Return the area of the pile."""
        ...
    @property
    def perimeter(self) -> float:
        """Return the perimeter of the pile."""
        ...

class ConcreteSquarePile(BasicPile):
    """Concrete square pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, width: float = 0.8):
        """
        Initialize ConcreteSquarePile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.   
        
        length (m): float, default: 10.0
            The length of the pile.
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        width (m): float, default: 0.8
            The width of the pile.
        """
        ...
    @property
    def area(self) -> float:
        """Return the area of the pile."""
        ...
    @property
    def perimeter(self) -> float:
        """Return the perimeter of the pile."""
        ...

class SteelPipePile(BasicPile):
    """Steel pipe pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, outer_diameter: float = 0.8, section_type: Literal[Any, Any, Any] = "full_open", num_partition: Literal[Any, Any, Any] = 2):
        """
        Initialize SteelPipePile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        outer_diameter (m): float, default: 0.8
            The outer diameter of the pile.
        
        section_type: Literal["full_open", "half_open", "full_closed"], default: "full_open"
            The section type of the pile.
            full_open: 完全敞口
            half_open: 半敞口
            full_closed: 完全闭口
        
        num_partition: int, default: 2
            The number of partitions of the pile.
            Only available when the section_type is "half_open".
        """
        ...
    @property
    def area(self) -> float:
        """Return the area of the pile."""
        ...
    @property
    def perimeter(self) -> float:
        """Return the perimeter of the pile."""
        ...

class ConcreteHollowPile(BasicPile):
    """Concrete hollow pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, outer_diameter: float = 0.8, inner_diameter: float = 0.6, section_shape: Literal[Any, Any] = "circular"):
        """
        Initialize ConcreteHollowPile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.   
        
        length (m): float, default: 10.0
            The length of the pile.
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        outer_diameter (m): float, default: 0.8
            If the section_shape is "circular", the outer_diameter is the diameter of the pile.
            If the section_shape is "square", the outer_diameter is the side length of the pile.
        
        inner_diameter (m): float, default: 0.6
            The inner diameter of the pile.
        
        section_shape: Literal["circular", "square"], default: "circular"
            The section shape of the pile.
        """
        ...
    @property
    def perimeter(self) -> float:
        """Return the perimeter of the pile."""
        ...

class RockSocketedPile(BasicPile):
    """Rock socketed pile class"""
    def __init__(self, name: Any = None, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, diameter: float = 0.8, width: float = 0.8, section_shape: Literal[Any, Any, Any] = "circular", formation: Literal[Any, Any, Any] = "mud_wall"):
        """
        Initialize RockSocketedPile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        top (m): float, default: 0.0
            The top elevation of the pile.
        
        length (m): float, default: 10.0
            The length of the pile.
        
        design_ground_elev (m): float, default: 0.0
            The design ground elevation.
        
        diameter (m): float, default: 0.8
            If the section_shape is "circular", the diameter is the diameter of the pile.
            If the section_shape is "square", the diameter is the side length of the pile.
            If the section_shape is "rectangular", the diameter is the longer side length of the pile.
        
        width (m): float, default: 0.8
            The width of the pile. The shorter side length of the pile.
            Only available when the section_shape is "rectangular".
        
        section_shape: Literal["circular", "square", "rectangular"], default: "circular"
            The section shape of the pile.
        
        formation: Literal["mud_wall", "dry_work", "mud_wall_then_grout"], default: "mud_wall"
            The formation of the pile.
            mud_wall: 泥浆护壁成桩
            dry_work: 干作业成桩
            mud_wall_then_grout: 泥浆护壁成桩后注浆
        """
        ...
    @property
    def perimeter(self) -> Any:
        ...
    @property
    def area(self) -> Any:
        ...

class BasicCompositePile:
    """Basic composite pile class"""
    def __init__(self, name: Any = None, diameter: float = 0.5, charac_composite_soil_bc: float = 100.0, pile_layout: Literal[Any, Any, Any] = "triangle", pile_space: float = 1.0, longitudinal_space: float = 1.0, lateral_space: float = 1.2) -> Any:
        """
        Initialize BasicCompositePile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        diameter: float, default: 0.5
            The diameter of the pile.
        
        charac_composite_soil_bc: float, default: 100.0
            The characteristic composite soil bearing capacity.
        
        pile_layout: Literal["triangle", "square", "rectangular"], default: "triangle"
            The layout of the pile.
            triangle: 等边三角形
            square: 正方形
            rectangular: 矩形
        
        pile_space: float, default: 1.0
            The space between the piles.
            Only available when the pile_layout is "triangle" or "square".
        
        longitudinal_space: float, default: 1.0
            The longitudinal space between the piles.
            Only available when the pile_layout is "rectangular".
        
        lateral_space: float, default: 1.2
            The lateral space between the piles.
            Only available when the pile_layout is "rectangular".
        """
        ...
    @property
    def pile_type(self) -> Any:
        """Return the type of the pile."""
        ...
    @property
    def area(self) -> float:
        """Return the area of the pile."""
        ...
    @property
    def perimeter(self) -> float:
        """Return the perimeter of the pile."""
        ...
    @property
    def area_replace_ratio(self) -> float:
        """Return the area replace ratio of the pile. 面积置换率"""
        ...

class FlexiblePile(BasicCompositePile):
    """Flexible pile class"""
    def __init__(self, name: Any = None, diameter: float = 0.5, charac_composite_soil_bc: float = 100.0, pile_layout: Literal[Any, Any, Any] = "triangle", pile_space: float = 1.0, longitudinal_space: float = 1.0, lateral_space: float = 1.2, pile_soil_stress_ratio: float = 1.5):
        """
        Initialize FlexiblePile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        diameter: float, default: 0.5
            The diameter of the pile.
        
        charac_composite_soil_bc: float, default: 100.0
            The characteristic composite soil bearing capacity.
        
        pile_layout: Literal["triangle", "square", "rectangular"], default: "triangle"
            The layout of the pile.
            triangle: 等边三角形
            square: 正方形
            rectangular: 矩形
        
        pile_space: float, default: 1.0
            The space between the piles.
            Only available when the pile_layout is "triangle" or "square".
        
        longitudinal_space: float, default: 1.0
            The longitudinal space between the piles.
            Only available when the pile_layout is "rectangular".
        
        lateral_space: float, default: 1.2
            The lateral space between the piles.
            Only available when the pile_layout is "rectangular".
        
        pile_soil_stress_ratio: float, default: 1.5
            The pile soil stress ratio. 复合地基桩土应力比
        """
        ...

class RigidPile(BasicCompositePile):
    """Rigid pile class"""
    def __init__(self, name: Any = None, diameter: float = 0.5, charac_composite_soil_bc: float = 100.0, pile_layout: Literal[Any, Any, Any] = "triangle", pile_space: float = 1.0, longitudinal_space: float = 1.0, lateral_space: float = 1.2, top: float = 0.0, length: float = 10.0, design_ground_elev: float = 0.0, pile_bc_factor: float = 1.2, composite_soil_bc_factor: float = 1.2, base_resistance_factor: float = 1.2):
        """
        Initialize BasicCompositePile Object.
        
        Parameters
        ----------
        name: str | None, default: None
            The name of the pile.
        
        diameter: float, default: 0.5
            The diameter of the pile.
        
        charac_composite_soil_bc: float, default: 100.0
            The characteristic composite soil bearing capacity.
        
        pile_layout: Literal["triangle", "square", "rectangular"], default: "triangle"
            The layout of the pile.
            triangle: 等边三角形
            square: 正方形
            rectangular: 矩形
        
        pile_space: float, default: 1.0
            The space between the piles.
            Only available when the pile_layout is "triangle" or "square".
        
        longitudinal_space: float, default: 1.0
            The longitudinal space between the piles.
            Only available when the pile_layout is "rectangular".
        
        lateral_space: float, default: 1.2
            The lateral space between the piles.
            Only available when the pile_layout is "rectangular".
        
        top: float, default: 0.0
            The top elevation of the pile.
        
        length: float, default: 10.0
            The length of the pile.
        
        design_ground_elev: float, default: 0.0
            The design ground elevation.
        
        pile_bc_factor: float, default: 1.2
            The pile bearing capacity factor. 单桩承载力发挥系数, lambda
        
        composite_soil_bc_factor: float, default: 1.2
            The composite soil bearing capacity factor. 桩间土承载力发挥系数, beta
        
        base_resistance_factor: float, default: 1.2
            The base resistance factor. 端阻力发挥系数, alpha_p
        """
        ...
